using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using umbSearch.businessLogic.defaultFilters.helpers;

namespace umbSearch.businessLogic.defaultFilters
{
    public class IndexMsOffice : interfaces.IUmbracoSearchFileFilter
    {
		public IndexMsOffice()
		{
			//
			// TODO: Add constructor logic here
			//
		}

		#region IUmbracoSearchFileFilter Members

		public string[] extensions
		{
			get
			{
				string[] _extensions = {"xls,ppt,doc,docx,xlsx,pptx"};
				return _extensions;
			}
		}

		public string returnText(string FullPathToFile)
		{
			try 
			{
                return OfficeIndexer.Parse(FullPathToFile);
			} 
			catch (Exception ee)
			{
				throw new Exception("Error indexing file '" + FullPathToFile + "'",ee);
			}
		}

		#endregion
	}
}
